-
Notifications
You must be signed in to change notification settings - Fork 5
atomic-css major refactor! Please Review. Fixes #17 #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
classier, stuck on [] wierd solution with catchall list instance and empty list ToCSS major refactor! Class->Rule, Rule+media, new modules done! big improvement on before media separate type removed context wip wip refactoring back simple html definition merge selector coming along, stuck with Html : Html got Html effect to work with funky nested state stuff View with Html (). Stuck as attributes require annotations better factoring of atomic utility classes with property-based overrides! hover, bold external classes promising direction with 2 different operators wip looking good! Just can't do single tags sexy stuck on newtypes / stack layer ModAtts, ModStyles - figured out how to do single tags! moved things into atomic cleanup moving files into place example of using blaze making progress! forced to redefine everything WIP - wait, how would blaze work interesting! external type family, Category Attributes and Styles Working? Moved addAttribute to Attributable stuck - cant figure out how to resolve text reverted IsHtml Working! Wow! Styles [Rule] etc. refactored Styleable refactor Render fixed blaze example, much simpler! improved blaze CSS override rules, tests render tests, pseudo + media> NEEDS: parent? RuleSelector = Custom | FromClass refactoring: Styleable -> CSS, Attributable -> Html, etc render tests merge classes with attribute uniqueRules built in ancestor! Ready to publish atomic-css examples working switched to colon separator PxRem, Length, TRBL tests exports renamed to atomic-css renaming refactor module names refactor names and modules attributes removed web.view more refactors added Styleable to CSS fixed align infinite loop pseudo refactor attributable, styleable (a -> b) exports fixed blaze example slow error: speedup with rule map refactored Html to a list newtype remove Empty
Thanks! I'll take a deeper into it but the new interface operator looks quite intuitive! |
Any and all comments welcome! I'd especially like to hear how you like the new interface. I'm open to hearing ideas about better operators if you can think of any. Take a look at https://github.com/seanhess/atomic-css/blob/atomic-css/example/app/Main.hs |
@seanhess, the code does not currently compile (missing foldl' import) Could you bring it to a working state to facilitate the review? |
Fixed. Sorry about that, I was going fast and only testing on GHC 9.10. Tests are now passing on 9.10, 9.8, and 9.6. |
Last call for feedback! Going to merge and publish this tomorrow. |
It's a big PR and I'm still learning Haskell in a way so, my review will be more of a user-experience feedback than anything :) Overall I like this change, separating attributes and styles makes the API feel more natural. Even if the types are still complicated, they make sens! There seems to be a lot of cool functionality there, I'll have to play more with this lib! (I had only used Hyperbole up to now) Great job 👍 |
(I don’t have a time window at this short notice to look into this.)
…On Tue, 20 May 2025, at 21:45, Benjamin Thomas wrote:
*benjamin-thomas* left a comment (seanhess/atomic-css#21) <#21 (comment)>
It's a big PR and I'm still learning Haskell in a way so, my review will be more of a user-experience feedback than anything :)
Overall I like this change, separating attributes and styles makes the API feel more natural. Even if the types are still complicated, they make sens!
There seems to be a lot of cool functionality there, I'll have to play more with this lib! (I had only used Hyperbole up to now)
Great job 👍
—
Reply to this email directly, view it on GitHub <#21 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAJ3EVKY74B6TFMWAMNU57327OA6PAVCNFSM6AAAAAB46TNZ7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQOJVGY2TOMZQGU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Since I was asked for feedback here seanhess/hyperbole#108 (comment). |
Thanks everyone for your feedback! |
As mentioned in #20 - I have completely rewritten this library. It is now focused exclusively on implementing Atomic CSS. The "View" type with its ViewId reader context will be moved to hyperbole. This library could now be used with Blaze or another html combinator library if desired.
@kfigiela @Skyfold @benjaminweb @benjamin-thomas @tusharad - please review if you can!
New library:
atomic-css
This libary will be named "atomic-css" instead of "web-view". The old package will be deprecated. There will be a Web.Hyperbole.View that builds on this libary to add the features it needs.
This will be explicity opt-in for Hyperbole. I changed my mind about ease-of-use. I think it will help to inform users that this functionality comes from this package.
New Interface
Instead of tags requiring a "Mod" argument, we have implemented two operators in the style of Blaze's
(!)
. Attributes are applied with@
, and Utility classes are applied with~
.This is what it used to be:
These are completely separate, so while you can compose attributes with each other, you can't compose an attribute and a utility:
Built-in Html Monad
This library includes an
Html
monad, which makes this a functional rendering library. It does not export any HTML tag functions, leaving this to downstream libraries.Override Styles, Fixes #17
CSS now automatically overrides any previously applied utilities that affect the same property. If you create a "component" that sets some styles, you can easily override anything without worrying about precedence:
Easy Custom CSS
I started down this path after becoming annoyed at the difficulty writing css-only tooltips. These required custom selectors. The previous interface was confusing. Now, you can create custom css rules, and these will not be modified by
hover
, etc. The example below predicatably adds a "tooltips" class to the the parent, and shows the ".tooltip" child when you hover over anything inside it.It's also much easier to define your own utilities if any are missing or you need something custom: